package com.antler.smt.portal.controller;

import com.antler.smt.portal.annotation.OperateCut;
import com.antler.smt.request.portal.SearchReq;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.portal.SearchOrderService;
import com.antler.smt.validate.DataValidator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zhangyi
 * @date 2018/9/19 17:39
 */
@RestController
@RequestMapping("/search")
@Api(description = "条件筛选订单")
public class SearchController extends BaseController{

    @Resource
    private SearchOrderService searchOrderService;

    /**
     * 分类查询订单
     *
     * @param searchReq
     * @return
     */
    @GetMapping("/seekOrder")
    @OperateCut(operationContent = "分类查询订单")
    @ApiOperation(value = "条件筛选订单",httpMethod = "GET")
    public Result getOrderInfo(SearchReq searchReq){
        DataValidator.isNull(searchReq,"请求实体不能为空！");
        searchReq.setMemberId(currentMember.getId());
        return searchOrderService.searchOrder(searchReq);
    }
}
